<include file="application/admin/view/public/left.html"/>
   
 <div id="dcMain">
   <!-- 当前位置 -->
<div id="urHere">管理中心<b>></b><strong>地级代理管理</strong> </div>   <div class="mainBox" style="height:auto!important;height:550px;min-height:550px;">
        <h3>{$p.areaName}下属</h3>
    <table width="100%" border="0" cellpadding="8" cellspacing="0" class="tableBasic" id="hTable">
    <tr align="center">
        <th>ID</th>
        <th>省/市/区</th>
        <th>会员姓名</th>
        <th>代理时间</th>
        <th>状态</th>
        <th>累计充值</th>
        <th>操作</th>
    </tr>
    <volist name='info' id='vo'>
    <tr align="center">
        <td>{$vo.areaId}</td>
        <td>{$vo.areaName}</td>
        <td>{$vo.name}</td>
        <td>
             <eq name="vo.status" value="0">
                
            </eq>
            <eq name="vo.status" value="1">
                {$vo.add_time|date='Y-m-d H:i:s',###}
            </eq>

        </td>
   
        <td>
            <eq name="vo.status" value="1">
                  代理中
            </eq>
            <eq name="vo.status" value="0">
                  等待中
            </eq>
        </td> 
        <td>{$vo.all_chongzhi}</td>
        <td>
            <a class="link-update" href="{:U('Area/qu',array('id'=>$vo['areaId']))}">查看下属</a>
            <a class="link-del" href="{:U('Area/details',array('id'=>$vo['areaId']))}" >填写</a>
            <a class="link-del" href="{:U('Finance/index',array('area_id'=>$vo['areaId']))}">查看日志</a>
             <eq name="vo.status" value="1">
                  <a class="link-del" href="{:U('Area/deleteDaiLi',array('area_id'=>$vo['areaId']))}" >删除代理</a>
            </eq>
        </td>                      
        </tr>
    </volist>
    </table>
    {$page}
</div>
</div>
<div class="clear"></div>
<include file="application/admin/view/public/foot.html"/><!-- dcFooter 结束 -->
<div class="clear"></div> </div>
</body>
</html>
<script type="text/javascript">
   window.onload = function ()
    {
        var table = document.getElementById ('hTable');
        console.log(table)
        var tbody = table.tBodies[0];
        var rows = tbody.rows;
        var cells = rows[0].cells;
        for ( var j = 0; j < cells.length; j++)
        {
            cells[j].onclick = function ()
            {
                var asc = this.asc = !!this.asc ? -this.asc : -1;
                var array = [];
                array.index = this.cellIndex;
                for ( var i = 1; i < rows.length; i++)
                {
                    array.push (rows[i]);
                }
                array.sort (function (a, b)
                {
                    var n1 = a.cells[array.index].firstChild.nodeValue;
                    var n2 = b.cells[array.index].firstChild.nodeValue;
                    if (n1 > n2)
                    {
                        return asc;
                    }
                    else if (n1 < n2)
                    {
                        return -asc;
                    }
                    else
                    {
                        return 0;
                    }
                });
                 
                for ( var i = 0; i < array.length; i++)
                {
                    tbody.appendChild (array[i]);
                }
            }
        }
    }


</script>